<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
登录人: <span id="loginUser"></span>

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script>
    $.ajax({
        url: "/user2/getLoginUser",
        type: "get",
        success: function(username){
            $("#loginUser").text(username);
        }

    });
</script>
</body>
</html>